package com.frxuexi.park2212.repair

import android.widget.TextView
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.frxuexi.lib_base.entity.RepairBeanItem
import com.frxuexi.park2212.R

class RepairAdapter:BaseQuickAdapter<RepairBeanItem,BaseViewHolder>(R.layout.item_repair) {


    override fun convert(helper: BaseViewHolder, item: RepairBeanItem) {
        helper.setText(R.id.repair_Num,item.orderNumber)
        helper.setText(R.id.repair_time,item.repairTime)
        helper.setText(R.id.repair_user,item.repairName)
        helper.setText(R.id.repair_phone,item.contactMethod)
        helper.setText(R.id.repair_location,item.repairLocation)
        helper.setText(R.id.repair_desc,item.faultDescription)

        val tv_status = helper.getView<TextView>(R.id.repair_status)
        tv_status.setText(item.processingStatus)

        if(item.processingStatus=="已完成"){
            tv_status.setTextColor(context.getColor(R.color.green))
            tv_status.setBackgroundResource(R.drawable.shape_status)
        }else if(item.processingStatus=="处理中"){
            tv_status.setTextColor(context.getColor(R.color.blue))
            tv_status.setBackgroundResource(R.drawable.shape_zhanyong)
        }else {
            tv_status.setTextColor(context.getColor(R.color.orange))
            tv_status.setBackgroundResource(R.drawable.shape_weihu)
        }
    }
}